import { dealValueIsRight } from '@/pages/commodity/modules/utils/salePriceRequireUtils';
export const getMultiplePriceGroupColumnsFn = (data) => {
  let { handleViewOriginalPriceGroup } = data;
  let columns = [
    {
      title: '查看原价格组',
      align: 'center',
      fixed: 'left',
      render: (h, { row }) => {
        return (
          <el-button
            type="text"
            onClick={ () => { handleViewOriginalPriceGroup(row) } }
          >查看</el-button>
        )
      }
    },
    {
      title: 'SKU编码',
      key: 'skuNo',
      align: 'center',
      fixed: 'left',
      sortable: true
    },
    {
      title: '商品名称',
      key: 'productName',
      align: 'center',
      fixed: 'left',
      sortable: true
    },
    {
      title: '规格',
      key: 'spec',
      align: 'center',
      fixed: 'left',
      sortable: true
    },
    {
      title: '价格组',
      key: 'groupName',
      align: 'center'
    },
    {
      title: '城市',
      key: 'cityName',
      align: 'center',
      sortable: true
    },
    {
      title: '业务区域',
      key: 'businessArea',
      align: 'center',
      sortable: true
    },
    {
      title: '是否敏感商品',
      key: 'isPriceSensitive',
      align: 'center',
      formatter: (row, columns, cellValue) => {
        return cellValue === '1' ? '是' : '否';
      },
    },
    {
      title: '供货计量单位',
      key: 'supplyUnit',
      align: 'center'
    },
    {
      title: '主计量单位',
      key: 'mainUnit',
      align: 'center'
    },
    {
      title: '理论转换率',
      align: 'center',
      render: (h, { row }) => {
        return (<div>{ row.nowInput.theoryConverRate }</div>)
      }
    },
    {
      title: '实际转换率',
      align: 'center',
      render: (h, { row }) => {
        return (<div>{ dealValueIsRight(row.nowInput.realConverRate) }</div>)
      }
    },
    {
      title: '售价类型',
      key: 'saleType',
      align: 'center',
      render: (h, { row }) => {
        let saleTypeStr = '';
        if (row.nowInput.saleType === '1') {
          saleTypeStr = '统一售价';
        }
        if (row.nowInput.saleType === '2') {
          saleTypeStr = '区域售价';
        }
        return (<div>{ saleTypeStr }</div>)
      },
    },
    {
      title: '实际转换率辅计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.realBackUnitPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.realBackUnitPrice) }</div>)
          }
        }
      ],
    },
    {
      title: '理论转换率辅计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.theoryBackUnitPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.theoryBackUnitPrice) }</div>)
          }
        }
      ],
    },
    {
      title: '主计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.mainUnitPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.mainUnitPrice) }</div>)
          }
        }
      ],
    },
    {
      title: '主计量价浮动比率',
      key: 'mainUnitFloatRate',
      align: 'center'
    },
    {
      title: '加价类型',
      align: 'center',
      render: (h, { row }) => {
        let addPriceTypeName = '';
        if (row.nowInput.addPriceType === '1') {
          addPriceTypeName = '固定金额';
        }
        if (row.nowInput.addPriceType === '2') {
          addPriceTypeName = '比例';
        }
        return (<div>{ addPriceTypeName }</div>)
      }
    },
    {
      title: '销售面价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.oldInput.facePrice2) }</div>)
        }
      },
      {
        title: '现值',
        key: 'facePrice2',
        align: 'center',
        width: '160',
        type: 'specialNowInputNumber',
      }]
    },
    {
      title: '辅计量现金价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.oldInput.backUnitCashPrice) }</div>)
        }
      },
      {
        title: '现值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.nowInput.backUnitCashPrice) }</div>)
        }
      }]
    },
    {
      title: '主计量现金价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.oldInput.mainUnitCashPrice) }</div>)
        }
      },
      {
        title: '现值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.nowInput.mainUnitCashPrice) }</div>)
        }
      },
      {
        title: '浮动率',
        align: 'center',
        key: 'cashFloatRate'
      }]
    },
    {
      title: '现金标准加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.cashAddRateOrMoney) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'cashAddRateOrMoney',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '现金实时加价比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.realCashPriceAddRate) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'realCashPriceAddRate',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '辅计量分销价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.backUnitDistribPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.backUnitDistribPrice) }</div>)
          }
        }
      ],
    },
    {
      title: '主计量分销价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.mainUnitDistribPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.mainUnitDistribPrice) }</div>)
          }
        },
        {
          title: '浮动率',
          align: 'center',
          key: 'distribFloatRate'
        },
      ],
    },
    {
      title: '分销与现金差额/差率',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.distribCashDiffRateOrMoney) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'distribCashDiffRateOrMoney',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '分销实时加价率',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.realDistribPriceAddRate) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.realDistribPriceAddRate) }</div>)
          }
        }
      ],
    },
    {
      title: '现分销与现金差价率',
      align: 'center',
      render: (h, { row }) => {
        return (<div>{ dealValueIsRight(row.oldInput.distribCashDiffRateOrMoney) }</div>)
      }
    },
    {
      title: '辅计量售价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.backUnitSalePrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.backUnitSalePrice) }</div>)
          }
        }
      ],
    },
    {
      title: '主计量售价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.mainUnitSalePrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.mainUnitSalePrice) }</div>)
          }
        },
        {
          title: '浮动率',
          align: 'center',
          key: 'saleFloatRate'
        },
      ],
    },
    {
      title: '售价标准加价率/金额',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.saleAddRateOrMoney) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'saleAddRateOrMoney',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '售价实时加价率',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.realSalePriceAddRate) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'realSalePriceAddRate',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '现金辅计量批量价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.cashBackUnitBatchPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.cashBackUnitBatchPrice) }</div>)
          }
        }
      ],
    },
    {
      title: '现金辅计量批量加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.cashBackUnitAddRateOrMoney) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'cashBackUnitAddRateOrMoney',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '售价辅计量批量价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.saleBackUnitBatchPrice) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.nowInput.saleBackUnitBatchPrice) }</div>)
          }
        }
      ],
    },
    {
      title: '售价辅计量批量加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          render: (h, { row }) => {
            return (<div>{ dealValueIsRight(row.oldInput.saleBackUnitAddRateOrMoney) }</div>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'saleBackUnitAddRateOrMoney',
          width: 160,
          type: 'nowInputNumChange'
        }
      ],
    },
    {
      title: '限制展示价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.oldInput.limitShowPrice) }</div>)
        }
      },
      {
        title: '现值',
        key: 'limitShowPrice',
        align: 'center',
        width: '160',
        type: 'specialNowInputNumber',
      }]
    },
    {
      title: '限制交易价',
      align: 'center',
      children: [{
        title: '原值',
        align: 'center',
        render: (h, { row }) => {
          return (<div>{ dealValueIsRight(row.oldInput.limitTradePrice) }</div>)
        }
      },
      {
        title: '现值',
        key: 'limitTradePrice',
        align: 'center',
        width: '160',
        type: 'specialNowInputNumber',
      }]
    },
    {
      title: '操作',
      key: 'action',
      align: 'center',
      fixed: 'right'
    }
  ]
  return columns;
}
